package com.example.eddie.test.MyDatabases;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by eddie on 28/08/2017.
 */

public class MyDatabaseHelper extends SQLiteOpenHelper {

    private static final String CREATE_DATABASE1 = "create table TeacherInfo(" +
            "id integer primary key autoincrement," +
            "teacherName text," +
            "teacherID text)";
    private static final String CREATE_DATABASE2 = "create table ClassNameInfo(" +
            "id integer primary key autoincrement," +
            "className text," +
            "classID text)";
    private static final String CREATE_DATABASE3 = "create table ClassRoomInfo(" +
            "id integer primary key autoincrement," +
            "RoomName text," +
            "RoomID text)";
    private static final String CREATE_DATABASE4 = "create table BuildInfo(" +
            "id integer primary key autoincrement," +
            "name text," +
            "number text)";

    public MyDatabaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        try{
            db.execSQL(CREATE_DATABASE1);
            db.execSQL(CREATE_DATABASE2);
            db.execSQL(CREATE_DATABASE3);
            db.execSQL(CREATE_DATABASE4);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
